<?php

function ee_print_array($array) {
	echo '<pre>'.print_r($array, true).'</pre>';
}

function get_file($file) {
	//echo $file . '<br/>';
	
	if(file_exists($file)) {
		if( ($handle = fopen($file, "r")) !== FALSE ) {
		
			$i = 0; 
			$db = array();
			while( ($lineData = fgetcsv($handle, 10000, ",")) !== FALSE ) {
				for ($j=0; $j<count($lineData); $j++) { 
					$db[$i][$j] = $lineData[$j]; 
				} 
				$i++;
			}
			fclose($handle);
			
			//ee_print_array($db); //die();
			return $db;
			
		} else {
			echo "An error occured opening the file: " . $file . '<br/>';
			die();
		}
	} else {
		echo "File does not exist: " . $file . '<br/>';
		die();
	}
}